import javax.swing.SwingWorker;

/**
 * @author Simon
 *
 */
public class DoItAllWorker extends SwingWorker<Void, Void> 
{
	Faculty firstFac,secondFac;
	String firstCol, secondCol;
	View v;
	
	public DoItAllWorker(Faculty firstFac, String firstCol, Faculty secondFac, String secondCol, View view)
	{
		this.firstFac = firstFac;
		this.firstCol = firstCol;
		this.secondFac = secondFac;
		this.secondCol = secondCol;
		this.v = view;
	}
	
	@Override
	protected Void doInBackground() throws Exception 
	{
		Thread t1 = new Thread(new FillWorker(firstFac, firstCol));
		Thread t2 = new Thread(new FillWorker(secondFac, secondCol));
		v.displayProgress();
		t1.start();
		t2.start();
		
		t1.join();
		t2.join();
		
		return null;
	}
	
	@Override
	public void done()
	{
		System.out.println("All Done");
		v.progframe.dispose();
		v.drawChart(firstFac, secondFac);
	}
}
